<?php

namespace App\Enums;

enum HttpType: int
{
    case SUCCESS = 200;
    case FAILED = 300;
    case TOKEN_INVALID = 401;
    case NO_PERMISSION = 403;
    case REQUEST_404_ERROR = 404;
    case SYSTEM_ERROR = 500;

    /**
     * 对应的名称
     * @return string
     */
    public function name(): string
    {
        return match ($this) {
            self::SUCCESS => '成功',
            self::FAILED => '失败',
            self::TOKEN_INVALID => 'token参数无效',
            self::NO_PERMISSION => '无相关权限',
            self::REQUEST_404_ERROR => '请求接口不存在',
            self::SYSTEM_ERROR => '系统错误',
        };
    }
}
